<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> 
    <title>Why choose vue.js</title>
</head>

<body>
    <ul class="js-items">
        <li v-if="!items.length">Sorry, there are no items.</li>
        <li v-for="item in items" :class="{ 'is-blue': item.includes('blue') }">
            {{ item }}</li>
    </ul>
    <script>   
        new Vue({
            el: '.js-items',
            data: {
                items: []
            },
            created() {
                var url = 'http://localhost:3000/items'
                //fetch('https://example.com/items.json')
                fetch(url).then((res) => res.json())
                    .then((data) => {
                        console.log(`data is ${data}`)
                        this.items = data.items;
                    });
            }
        });  
       
    </script>
<style>
    .is-blue{
        color:blue
    }
</style>
</body>

</html>